package com.hd.trans.files.adapter;

import android.view.View;
import android.widget.CheckBox;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.DiffUtil;

import com.hd.trans.R;
import com.hd.trans.files.holder.BaseViewHolder;
import com.hd.trans.files.model.FileSortModel;

public class SortFilesAdapter extends BaseAdapter<FileSortModel.ModeItem, BaseViewHolder> {

    public SortFilesAdapter() {
        super(new DiffUtil.ItemCallback<FileSortModel.ModeItem>() {
            @Override
            public boolean areItemsTheSame(@NonNull FileSortModel.ModeItem oldItem, @NonNull FileSortModel.ModeItem newItem) {
                return false;
            }

            @Override
            public boolean areContentsTheSame(@NonNull FileSortModel.ModeItem oldItem, @NonNull FileSortModel.ModeItem newItem) {
                return false;
            }
        });
    }

    @Override
    void bindViewHolder(BaseViewHolder holder, FileSortModel.ModeItem mode) {
        holder.setText(R.id.mode_sort_name, mode.getModeName());
        CheckBox cbSelect = holder.getView(R.id.mode_sort_cb);
        cbSelect.setChecked(mode.isSelect());

    }

    @Override
    BaseViewHolder createViewHolder(View itemView) {
        return new BaseViewHolder(itemView);
    }

    @Override
    int getLayoutId() {
        return R.layout.item_sort_file_layout;
    }
}
